#include "GY_GraphicsRotTick.h"
#include<complex>
#include<QtMath>
#include <QPen>
#include <QPainter>
#include <QDebug>
GY_GraphicsRotTick::GY_GraphicsRotTick(const QString &guid,QGraphicsItem *parent)
    :GY_BasicsGraphicsObject(guid,this,parent)
{
    //图元类型
    GY_Object::setUserData(GY_ENUM::ClassType,QVariant("RotTick"));
    initializationPropertyInfo();
    updateDraw();
    QMap<QVariant,QPointF> editPoints = {
        {"StartAnglePoint",m_PropertyInfoMap["StartAnglePoint"].propertyValue.toPointF()},
        {"AnglePoint",m_PropertyInfoMap["AnglePoint"].propertyValue.toPointF()},
        {"StartAngleLengthPoint",m_PropertyInfoMap["StartAngleLengthPoint"].propertyValue.toPointF()},
        {"AngleLengthPoint",m_PropertyInfoMap["AngleLengthPoint"].propertyValue.toPointF()}
    };
    this->setPen(QColor(Qt::green));
    this->setEditPointF(editPoints);
    this->setCenterPointF(m_PropertyInfoMap["Position"].propertyValue.toPointF());
}

GY_GraphicsRotTick::GY_GraphicsRotTick(const QString &guid,const QPointF &centeCircle, const qreal radius,
                                       const qreal startAngle, const qreal passingAngle, const int tickNum,
                                       const qreal tickLenth, QGraphicsItem *parent)
    :GY_BasicsGraphicsObject(guid,this,parent)
{
    //图元类型
    GY_Object::setUserData(GY_ENUM::ClassType,QVariant("RotTick"));
    initializationPropertyInfo();
    //初始化图形参数
    m_PropertyInfoMap["StartAngle"].propertyValue=startAngle;
    m_PropertyInfoMap["Angle"].propertyValue=passingAngle;
    m_PropertyInfoMap["NumTicks"].propertyValue=tickNum;
    m_PropertyInfoMap["Position"].propertyValue=centeCircle;
    m_PropertyInfoMap["Radius"].propertyValue=radius;
    m_PropertyInfoMap["TickLength"].propertyValue=tickLenth;
    updateDraw();
    calculateStartAnglePointPosition();
    calculateAnglePointPosition();
    calculateStartAngleLengthPointPosition();
    calculateAngleLengthPointPosition();
    this->setCenterPointF(m_PropertyInfoMap["Position"].propertyValue.toPointF());
}
/**
 * @brief initializationPropertyInfo 初始化属性信息
 */
void GY_GraphicsRotTick::initializationPropertyInfo()
{
    GY_PropertyInfo ObjectName(this);
    ObjectName.propertyName = "ObjectName";
    ObjectName.propertyValue = QString();
    ObjectName.updateType = Update|OrdinaryAttributes;
    ObjectName.propertyType = QStringPropertyType;
    ObjectName.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateObjectName;
    m_PropertyInfoMap.insert("ObjectName",ObjectName);
    m_PropertyInfoMap[ObjectName.propertyName].setConnect();
    //位置
    GY_PropertyInfo positonPropertyInfo(this);
    positonPropertyInfo.propertyName="Position";
    positonPropertyInfo.propertyValue=QPointF(0,0);
    positonPropertyInfo.updateType = Update|MoveUpdate|PointOfRelative;
    positonPropertyInfo.propertyType = PointPropertyType;
    positonPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateCirlePoint;
    m_PropertyInfoMap.insert(positonPropertyInfo.propertyName,positonPropertyInfo);
    m_PropertyInfoMap[positonPropertyInfo.propertyName].setConnect();
    //半径
    GY_PropertyInfo radiusPropertyInfo(this);
    radiusPropertyInfo.propertyName="Radius";
    radiusPropertyInfo.propertyValue=180.0;
    radiusPropertyInfo.propertyType = DoublePropertyType;
    radiusPropertyInfo.updateType = Update|OrdinaryAttributes;
    radiusPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateRadius;
    m_PropertyInfoMap.insert(radiusPropertyInfo.propertyName,radiusPropertyInfo);
    m_PropertyInfoMap[radiusPropertyInfo.propertyName].setConnect();
    //刻度长度
    GY_PropertyInfo tickLenthPropertyInfo(this);
    tickLenthPropertyInfo.propertyName="TickLength";
    tickLenthPropertyInfo.propertyValue=20.0;
    tickLenthPropertyInfo.updateType = Update|OrdinaryAttributes;
    tickLenthPropertyInfo.propertyType = DoublePropertyType;
    tickLenthPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateTickLenth;
    m_PropertyInfoMap.insert(tickLenthPropertyInfo.propertyName,tickLenthPropertyInfo);
    m_PropertyInfoMap[tickLenthPropertyInfo.propertyName].setConnect();
    //刻度数量
    GY_PropertyInfo scaleNumPropertyInfo(this);
    scaleNumPropertyInfo.propertyName="NumTicks";
    scaleNumPropertyInfo.propertyValue=32;
    scaleNumPropertyInfo.updateType = Update|OrdinaryAttributes;
    scaleNumPropertyInfo.propertyType = IntPropertyType;
    scaleNumPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateNumTicks;
    m_PropertyInfoMap.insert(scaleNumPropertyInfo.propertyName,scaleNumPropertyInfo);
    m_PropertyInfoMap[scaleNumPropertyInfo.propertyName].setConnect();
    //开始角度
    GY_PropertyInfo startAnglePropertyInfo(this);
    startAnglePropertyInfo.propertyName="StartAngle";
    startAnglePropertyInfo.propertyValue=0.0;
    startAnglePropertyInfo.updateType = Update|OrdinaryAttributes;
    startAnglePropertyInfo.propertyType = DoublePropertyType;
    startAnglePropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateStartAngle;
    m_PropertyInfoMap.insert(startAnglePropertyInfo.propertyName,startAnglePropertyInfo);
    m_PropertyInfoMap[startAnglePropertyInfo.propertyName].setConnect();
    //经过角度
    GY_PropertyInfo passAnglePropertyInfo(this);
    passAnglePropertyInfo.propertyName="Angle";
    passAnglePropertyInfo.propertyValue=180.0;
    passAnglePropertyInfo.updateType = Update|OrdinaryAttributes;
    passAnglePropertyInfo.propertyType = DoublePropertyType;
    passAnglePropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateAngele;
    m_PropertyInfoMap.insert(passAnglePropertyInfo.propertyName,passAnglePropertyInfo);
    m_PropertyInfoMap[passAnglePropertyInfo.propertyName].setConnect();
    //开始角度点
    GY_PropertyInfo startAnglePointPropertyInfo(this);
    startAnglePointPropertyInfo.propertyName="StartAnglePoint";
    startAnglePointPropertyInfo.propertyValue=QPointF(180,0);
    startAnglePointPropertyInfo.updateType = NotUpdate;
    startAnglePointPropertyInfo.propertyType = PointPropertyType;
    startAnglePointPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateStartAnglePoint;
    m_PropertyInfoMap.insert(startAnglePointPropertyInfo.propertyName,startAnglePointPropertyInfo);
    m_PropertyInfoMap[startAnglePointPropertyInfo.propertyName].setConnect();
    //经过角度点
    GY_PropertyInfo passAnglePointPropertyInfo;
    passAnglePointPropertyInfo.propertyName="AnglePoint";
    passAnglePointPropertyInfo.propertyValue=QPointF(-180,0);
    passAnglePointPropertyInfo.updateType = NotUpdate;
    passAnglePointPropertyInfo.propertyType = PointPropertyType;
    passAnglePointPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateAnglePoint;
    m_PropertyInfoMap.insert(passAnglePointPropertyInfo.propertyName,passAnglePointPropertyInfo);
    m_PropertyInfoMap[passAnglePointPropertyInfo.propertyName].setConnect();
    //开始角度长度编辑点
    GY_PropertyInfo startAngleLengthPointPropertyInfo;
    startAngleLengthPointPropertyInfo.propertyName="StartAngleLengthPoint";
    startAngleLengthPointPropertyInfo.propertyValue=QPointF(160,0);
    startAngleLengthPointPropertyInfo.updateType = NotUpdate;
    startAngleLengthPointPropertyInfo.propertyType = PointPropertyType;
    startAngleLengthPointPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateStartAngleLengthPoint;
    m_PropertyInfoMap.insert(startAngleLengthPointPropertyInfo.propertyName,startAngleLengthPointPropertyInfo);
    m_PropertyInfoMap[startAngleLengthPointPropertyInfo.propertyName].setConnect();
    //经过角度长度编辑点
    GY_PropertyInfo passAngleLengthPointPropertyInfo;
    passAngleLengthPointPropertyInfo.propertyName="AngleLengthPoint";
    passAngleLengthPointPropertyInfo.propertyValue=QPointF(-160,0);
    passAngleLengthPointPropertyInfo.updateType = NotUpdate;
    passAngleLengthPointPropertyInfo.propertyType = PointPropertyType;
    passAngleLengthPointPropertyInfo.updatePropertyFun=(GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateAngleLengthPoint;
    m_PropertyInfoMap.insert(passAngleLengthPointPropertyInfo.propertyName,passAngleLengthPointPropertyInfo);
    m_PropertyInfoMap[passAngleLengthPointPropertyInfo.propertyName].setConnect();
    /********************************************公共属性***********************************************/
    GY_PropertyInfo penOpacity(this);
    penOpacity.propertyName = "PenOpacity";
    penOpacity.propertyValue = qreal(1);
    penOpacity.updateType = Update|OrdinaryAttributes;
    penOpacity.propertyType = QrealPropertyType;
    penOpacity.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updatePenOpacity;
    m_PropertyInfoMap.insert(penOpacity.propertyName,penOpacity);
    m_PropertyInfoMap[penOpacity.propertyName].setConnect();

    GY_PropertyInfo LineStyle(this);
    LineStyle.propertyName = "LineStyle";
    LineStyle.propertyValue = QVariant();
    LineStyle.updateType = Update|OrdinaryAttributes;
    LineStyle.propertyType = LineStylePropertyType;
    LineStyle.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateLineStyle;
    m_PropertyInfoMap.insert("LineStyle",LineStyle);
    m_PropertyInfoMap[LineStyle.propertyName].setConnect();

    GY_PropertyInfo PenColor(this);
    PenColor.propertyName = "PenColor";
    PenColor.propertyValue = QColor(255,255,255);
    PenColor.updateType = Update|OrdinaryAttributes;
    PenColor.propertyType = ColorPropertyType;
    PenColor.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updatePenColor;
    m_PropertyInfoMap.insert("PenColor",PenColor);
    m_PropertyInfoMap[PenColor.propertyName].setConnect();

    GY_PropertyInfo PenAttributes(this);
    PenAttributes.propertyName = "PenAttributes";
    PenAttributes.propertyValue = false;
    PenAttributes.updateType = Update|OrdinaryAttributes;
    PenAttributes.propertyType = BoolPropertyType;
    PenAttributes.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updatePenAttributes;
    m_PropertyInfoMap.insert("PenAttributes",PenAttributes);
    m_PropertyInfoMap[PenAttributes.propertyName].setConnect();

    GY_PropertyInfo isVisible(this);
    isVisible.propertyName = "IsVisible";
    isVisible.propertyValue = true;
    isVisible.updateType = Update|OrdinaryAttributes;
    isVisible.propertyType = BoolPropertyType;
    isVisible.updatePropertyFun = (GY_PropertyInfo::UpdatePropertyFun)&GY_GraphicsRotTick::updateIsVisible;
    m_PropertyInfoMap.insert(isVisible.propertyName,isVisible);
    m_PropertyInfoMap[isVisible.propertyName].setConnect();

}
void GY_GraphicsRotTick::updateDraw()
{
    //!圆心X坐标
    qreal circleX=m_PropertyInfoMap.value("Position").propertyValue.toPointF().x();
    //!圆心Y坐标
    qreal circleY=m_PropertyInfoMap.value("Position").propertyValue.toPointF().y();
    //!半径
    qreal radius=m_PropertyInfoMap.value("Radius").propertyValue.toDouble();
    //!刻度线长度
    qreal tickLenth=m_PropertyInfoMap.value("TickLength").propertyValue.toDouble();
    //!刻度线数量
    int scaleNum=m_PropertyInfoMap.value("NumTicks").propertyValue.toInt();
    //!起始旋转角度
    qreal startAngle=m_PropertyInfoMap.value("StartAngle").propertyValue.toDouble();
    //!经过角度
    qreal passingAngle=m_PropertyInfoMap.value("Angle").propertyValue.toDouble();
    //根据起始旋转的角度计算每次坐标需要旋转的角度,按照100等分计算
    double rotate = (double)passingAngle / (scaleNum-1);
    QPainterPath path;
    path.moveTo(circleX, circleY);
    for (int i = 0; i < scaleNum; ++i) {
        qreal radian=qDegreesToRadians(startAngle+i*rotate); //弧度
        qreal nx=circleX+radius*cos(radian); //内圆点X
        qreal ny=circleY+radius*sin(radian); //内圆点Y
        qreal wx=circleX+(radius-tickLenth)*cos(radian); //外圆点X
        qreal wy=circleY+(radius-tickLenth)*sin(radian); //外圆点Y
        path.moveTo(nx, ny);
        path.lineTo(wx, wy);
    }
//    path.closeSubpath();
    this->setPath(path);
}
/**
 * @brief updateRadius 更新半径
 * @param name 属性名称
 * @param value 半径
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateRadius(const QString &name, const QVariant &value)
{
    if(!value.canConvert<double>())
    {
        return false;
    }
    m_PropertyInfoMap[name].propertyValue=value;
    updateDraw();
    calculateStartAnglePointPosition();
    calculateAnglePointPosition();
    calculateStartAngleLengthPointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
/**
 * @brief updateCirlePoint  更新中心点
 * @param name 属性名称
 * @param value 中心点位置
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateCirlePoint(const QString &name, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }

    m_PropertyInfoMap[name].propertyValue=this->mapFromScene(value.toPointF());
    this->setCenterPointF(this->mapFromScene(value.toPointF()));
    updateDraw();
    calculateStartAnglePointPosition();
    calculateAnglePointPosition();
    calculateStartAngleLengthPointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
/**
 * @brief updateTickLenth 更新刻度数量
 * @param name 属性名称
 * @param value 刻度数量
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateTickLenth(const QString &name, const QVariant &value)
{
    if(!value.canConvert<double>())
    {
        return false;
    }
    m_PropertyInfoMap[name].propertyValue=value;
    updateDraw();
    calculateStartAngleLengthPointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
/**
 * @brief updateNumTicks 更新刻度线长度
 * @param name 属性名称
 * @param value 刻度数量
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateNumTicks(const QString &name, const QVariant &value)
{
    if(!value.canConvert<int>()||value.toInt()<=0)
    {
        return false;
    }
    m_PropertyInfoMap[name].propertyValue=value;
    updateDraw();
    return true;
}
/**
 * @brief updateStartAngele 更新开始角度
 * @param name 属性名称
 * @param value 开始角度
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateStartAngle(const QString &name, const QVariant &value)
{
    if(!value.canConvert<double>())
    {
        return false;
    }
    m_PropertyInfoMap[name].propertyValue=value;
    updateDraw();
    calculateStartAnglePointPosition();
    calculateAnglePointPosition();
    calculateStartAngleLengthPointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
/**
 * @brief updatePassAngele 更新经过角度
 * @param name 属性名称
 * @param value 经过角度
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateAngele(const QString &name, const QVariant &value)
{
    if(!value.canConvert<double>())
    {
        return false;
    }
    m_PropertyInfoMap[name].propertyValue=value;
    updateDraw();
    calculateAnglePointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
void GY_GraphicsRotTick::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    QPen pen = this->pen();
    pen.setWidthF(pen.widthF()/painter->matrix().m11());
    painter->setPen(pen);
    painter->drawPath(this->path());
}
/**
 * @brief updateStartAnglePoint   更新开始角度点
 * @param name 属性名称
 * @param value 开始角度点
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateStartAnglePoint(const QString &, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }
    QPointF startAnglePoint;
    startAnglePoint=this->mapFromScene(value.toPointF());
    //基于圆心的偏移点
    QPointF diffPoint=startAnglePoint-m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    //计算半径
    m_PropertyInfoMap["Radius"].propertyValue=qSqrt(qPow(qAbs(diffPoint.x()),2)+qPow(qAbs(diffPoint.y()),2));
    //计算开始角度
    m_PropertyInfoMap["StartAngle"].propertyValue=qRadiansToDegrees(qAtan2(diffPoint.y(),diffPoint.x()));
    updateDraw();
    m_PropertyInfoMap["StartAnglePoint"].propertyValue=startAnglePoint;
    this->setEditPointF("StartAnglePoint",startAnglePoint);
    calculateAnglePointPosition();
    calculateStartAngleLengthPointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
/**
* @brief updateAnglePoint   更新经过角度点
* @param name 属性名称
* @param value 经过角度点
* @return 是否更新成功
*/
bool GY_GraphicsRotTick::updateAnglePoint(const QString &, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }
    QPointF anglePoint;
    anglePoint=this->mapFromScene(value.toPointF());
    //基于圆心的偏移坐标
    QPointF diffPoint=anglePoint-m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    //获取开始角度
    qreal startAngle=m_PropertyInfoMap.value("StartAngle").propertyValue.toDouble();
    //计算经过角度
    qreal pointRadians=qAtan2(diffPoint.y(),diffPoint.x());
    qreal pointAngle=qRadiansToDegrees(pointRadians);
    if(diffPoint.y()<0)
    {
        pointAngle=360+pointAngle;
    }
    qreal passAngle=pointAngle-startAngle;
    if(passAngle<0)
    {
        passAngle+=360;
    }
    m_PropertyInfoMap["Angle"].propertyValue=passAngle;
    updateDraw();
    calculateAnglePointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
/**
 * @brief updateStartAngleLengthPoint   更新开始角度长度点
 * @param name 属性名称
 * @param value 开始角度点
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateStartAngleLengthPoint(const QString &, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }
    QPointF startAngleLenthPoint;
    startAngleLenthPoint=this->mapFromScene(value.toPointF());
    //基于圆心的偏移坐标
    QPointF diffPoint=startAngleLenthPoint-m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    qreal pointRadius=qSqrt(qPow(qAbs(diffPoint.x()),2)+qPow(qAbs(diffPoint.y()),2));
    m_PropertyInfoMap["TickLength"].propertyValue=m_PropertyInfoMap.value("Radius").propertyValue.toDouble()-pointRadius;
    updateDraw();
    calculateStartAngleLengthPointPosition();
    calculateAngleLengthPointPosition();
    return true;
}
/**
 * @brief updateAngleLengthPoint   更新经过角度长度点
 * @param name 属性名称
 * @param value 开始角度点
 * @return 是否更新成功
 */
bool GY_GraphicsRotTick::updateAngleLengthPoint(const QString &, const QVariant &value)
{
    if(!value.canConvert<QPointF>())
    {
        return false;
    }
    QPointF angleLenthPoint;
    angleLenthPoint=this->mapFromScene(value.toPointF());
    //基于圆心的偏移坐标
    QPointF diffPoint=angleLenthPoint-m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    qreal pointRadius=qSqrt(qPow(qAbs(diffPoint.x()),2)+qPow(qAbs(diffPoint.y()),2));
    m_PropertyInfoMap["TickLength"].propertyValue=m_PropertyInfoMap.value("Radius").propertyValue.toDouble()-pointRadius;
    //获取开始角度
    qreal startAngle=m_PropertyInfoMap.value("StartAngle").propertyValue.toDouble();
    //计算经过角度
    qreal pointRadians=qAtan2(diffPoint.y(),diffPoint.x());
    qreal pointAngle=qRadiansToDegrees(pointRadians);
    if(diffPoint.y()<0)
    {
        pointAngle=360+pointAngle;
    }
    qreal passAngle=pointAngle-startAngle;
    if(passAngle<0)
    {
        passAngle+=360;
    }
    m_PropertyInfoMap["Angle"].propertyValue=passAngle;
    updateDraw();
    m_PropertyInfoMap["AngleLengthPoint"].propertyValue=angleLenthPoint;
    this->setEditPointF("AngleLengthPoint",angleLenthPoint);
    calculateAnglePointPosition();
    calculateStartAngleLengthPointPosition();
    return true;
}
/**
 * @brief precalculatedPosition 计算点位置
 * @param centerPoint  中心点位置
 * @param radius 半径
 * @param angele 角度
 * @return 计算得到的点位置
 */
QPointF GY_GraphicsRotTick::precalculatedPosition(const QPointF &centerPoint,const double radius,const double angele)
{
    qreal radian=qDegreesToRadians(angele); //弧度
    QPointF resultPoint;
    resultPoint.setX(cos(radian)*radius);
    resultPoint.setY(sin(radian)*radius);
    resultPoint+=centerPoint;
    return resultPoint;
}
/**
 * @brief calculateStartAnglePointPosition 计算开始角度点位置
 */
void GY_GraphicsRotTick::calculateStartAnglePointPosition()
{
    //!圆心
    QPointF centeCircle=m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    //!半径
    qreal radius=m_PropertyInfoMap.value("Radius").propertyValue.toDouble();
    //!起始旋转角度
    qreal startAngle=m_PropertyInfoMap.value("StartAngle").propertyValue.toDouble();
    QPointF startAnglePoint=precalculatedPosition(centeCircle,radius,startAngle);
    m_PropertyInfoMap["StartAnglePoint"].propertyValue=startAnglePoint;
    this->setEditPointF("StartAnglePoint",startAnglePoint);
}
/**
 * @brief calculateAnglePointPosition 计算经过角度点位置
 */
void GY_GraphicsRotTick::calculateAnglePointPosition()
{
    //!圆心
    QPointF centeCircle=m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    //!半径
    qreal radius=m_PropertyInfoMap.value("Radius").propertyValue.toDouble();
    //!起始旋转角度
    qreal startAngle=m_PropertyInfoMap.value("StartAngle").propertyValue.toDouble();
    //!经过角度
    qreal passingAngle=m_PropertyInfoMap.value("Angle").propertyValue.toDouble();
    QPointF anglePoint=precalculatedPosition(centeCircle,radius,startAngle+passingAngle);
    m_PropertyInfoMap["AnglePoint"].propertyValue=anglePoint;
    this->setEditPointF("AnglePoint",anglePoint);
}
/**
 * @brief calculateStartAngleLengthPointPosition 计算开始角度长度点位置
 */
void GY_GraphicsRotTick::calculateStartAngleLengthPointPosition()
{
    //!圆心
    QPointF centeCircle=m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    //!半径
    qreal radius=m_PropertyInfoMap.value("Radius").propertyValue.toDouble();
    //!刻度线长度
    qreal tickLenth=m_PropertyInfoMap.value("TickLength").propertyValue.toDouble();
    //!起始旋转角度
    qreal startAngle=m_PropertyInfoMap.value("StartAngle").propertyValue.toDouble();
    QPointF startAngleLengthPoint=precalculatedPosition(centeCircle,radius-tickLenth,startAngle);
    m_PropertyInfoMap["StartAngleLengthPoint"].propertyValue=startAngleLengthPoint;
    this->setEditPointF("StartAngleLengthPoint",startAngleLengthPoint);
}
/**
 * @brief calculateAngleLengthPointPosition 计算经过角度长度点位置
 */
void GY_GraphicsRotTick::calculateAngleLengthPointPosition()
{
    //!圆心
    QPointF centeCircle=m_PropertyInfoMap.value("Position").propertyValue.toPointF();
    //!半径
    qreal radius=m_PropertyInfoMap.value("Radius").propertyValue.toDouble();
    //!刻度线长度
    qreal tickLenth=m_PropertyInfoMap.value("TickLength").propertyValue.toDouble();
    //!起始旋转角度
    qreal startAngle=m_PropertyInfoMap.value("StartAngle").propertyValue.toDouble();
    //!经过角度
    qreal passingAngle=m_PropertyInfoMap.value("Angle").propertyValue.toDouble();
    QPointF angleLengthPoint=precalculatedPosition(centeCircle,radius-tickLenth,startAngle+passingAngle);
    m_PropertyInfoMap["AngleLengthPoint"].propertyValue=angleLengthPoint;
    this->setEditPointF("AngleLengthPoint",angleLengthPoint);
}
